home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HPAVC
/
HPAVC CD-ROM.iso
/
MCASM.RAR
/
MC_ASM.EXE
/
WROX_ASM
/
CH11
/
SHHCTEST.ASM
next >
Wrap
Assembly Source File
|
1994-08-25
|
6KB
|
185 lines
;*** WROX Tests *************************************************************
;
; SVGA - HiColor Modes - Address Calculation and Pixel Writting - S.Herd
;
;----------------------------------------------------------------------------
;
; Description:
; The program draws a diagonal line from top-left corner of screen to
; the bottom-right hand corner using code within the DRAW_LINE loop
; (this tests banks are switched correctly). By pressing return each
; time the line has been drawn the value of the 5 bit Blue component
; (within the RGB Word to be written to Video memory) is incremented
; (this happens 16 times i.e. Blue = 0 to 15) to test that the blue
; intensity of the line increases as would be expected from reading the
; text in chapter 11.
;
;----------------------------------------------------------------------------
;
; Results:
; Instead of the line getting bluer and bluer as the Blue value
; increased - the color simply cycles through the standard colours
; (i.e. 0 = black, 1 = blue, 2 = green, 3 = cyan etc.) suggesting that
; the color is being treated the same as in 256 color modes.
;
; In addtion to this, other tests show that writting:
;
; mov es:[bx],0001h
;
; will light one pixel (blue) and
;
; mov es:[bx],0101h
;
; will light two consequative pixels (both blue), suggesting that
;
; bytes per line = pixels per line
;
; and not
; bytes per line = pixels per line * 2
;
; as suggested for hicolor modes.
;
;----------------------------------------------------------------------------
;
; Equipment tested on:
; Adapter: TRIDENT TVGA9000 (VP90B)
; Bios : TRIDENT TVGA BIOS D3.0
; 512k VGA mode
;
;----------------------------------------------------------------------------
;
; Vesatest.exe report:
;
; VESA BIOS extension version 1.2 is installed.
; OEM string is : Copyright 1988-1991 TRIDENT MICROSYSTEMS INC.
;
; Device capabilities are 00000000
; Installed video memory size (in Kb) : 512
; Mode Attr WindowA WindowB Window Mem contr BPL Format Char BPP MM Pg
; att seg att seg gr siz call Cell NBP Bnks SoB
; 0170 H CG RW A000 64 64 3571:192A 1024 512x480 8x16 1 16 1 06 0 1
; 0171 H CG RW A000 64 64 3571:192A 1024 512x480 8x16 1 16 1 06 0 1
; 0100 HBCG RW A000 64 64 3571:192A 640 640x400 8x16 1 8 1 04 0 1
; 0101 HBCG RW A000 64 64 3571:192A 640 640x480 8x16 1 8 1 04 0 1
; 0103 HBCG RW A000 64 64 3571:192A 800 800x600 8x16 1 8 1 04 0 1
; 0104 HBCG RW A000 64 64 3571:192A 128 1024x768 8x16 4 4 1 03 0 1
; 0102 HBCG RW A000 64 64 3571:192A 100 800x600 8x16 4 4 1 03 0 1
; 006A HBCG RW A000 64 64 3571:192A 100 800x600 8x16 4 4 1 03 0 1
; 0108 HBCT RW A000 64 64 3571:192A 160 80x60 8x16 4 4 1 00 0 2
; 0109 HBCT RW A000 64 64 3571:192A 264 132x25 8x16 4 4 1 00 0 2
; 010A HBCT RW A000 64 64 3571:192A 264 132x43 8x16 4 4 1 00 0 2
; 010B HBCT RW A000 64 64 3571:192A 264 132x50 8x16 4 4 1 00 0 2
; 010C HBCT RW A000 64 64 3571:192A 264 132x60 8x16 4 4 1 00 0 2
;
;****************************************************************************
DOSSEG
.MODEL SMALL
.STACK 100h
.DATA
Y dw 0
X dw 0
Blue db 0
Red db 0
Green db 0
Mode dw 171h ;64k Colors 512 x 480 HiColor
BytesPL dw 1024 ;Bytes Per Line - abtained via 'Vesatest.exe'
Rows dw 480
.CODE
.386
;--- MAIN PROGRAM
push bx
push cx
push dx
push si
push di
push ds
push es
;--- Address data segment
mov ax,@data
mov ds,ax
;--- Set VESA Video Mode
mov ax,4f02h
mov bx,Mode
int 10h
;--- Address video memory
mov ax,0a000h
mov es,ax
NEXT_COLOR:
;--- Draw a diagonal line
mov Y,0
mov X,0
DRAW_LINE:
;--- Calculate pixel address
mov ax,Y ;AX = Y coordinate
mov bx,X ;BX = X coordinate
mul BytesPL ;AX = row offset in video memory from
;the beginning of the bank Lo(Y * BytesPerLine)
;DX = bank number Hi(Y * BytesPerLine)
shl bx,1 ;BX = X * 2 (word per pixel)
add bx,ax ;BX = word offset in video memory from
;the beginning of the bank
adc dx,0 ;bank-split-row catching
push bx
xor bx,bx
mov ax,4f05h ;--- Switch Bank
int 10h
;--- Write Pixel
mov al,Blue ;AL = blue component of pixel color
mov ah,Red ;AH = red component of pixel color
shl ah,3 ;shift by 2 if 32K colors, by 3 if 64K
movzx bx,Green ;BX = green component of pixel color
shl bx,5
or ax,bx
pop bx
mov es:[bx],ax ;<== WRITE PIXEL HERE
inc X
inc Y
mov ax,Rows
cmp Y,ax
jne DRAW_LINE
;--- Line Drawn - Wait for Keypress...
mov ah,8
int 21h
;--- Select Next Color
inc Blue
cmp Blue,16
jne NEXT_COLOR
;--- Reset Video Mode
mov ax,0003h
int 10h
pop es
pop ds
pop di
pop si
pop dx
pop cx
pop bx
mov ax,4c00h ; Exit program
int 21h
END
;****************************************************************************